{include file="common/head_s"/} 
<div class="admin-main layui-anim layui-anim-upbit" ng-app="hd" ng-controller="ctrl">
    <fieldset class="layui-elem-field layui-field-title">
        <legend>{$title}</legend>
    </fieldset>
  <!--  <div class="demoTable pd15 layui-form">  
        <a class="layui-btn layui-btn-primary" href="{:url(add)}" >提交提现申请</a>  
        <a class="layui-btn layui-btn-primary" href="{:url(addbank)}">添加收款账号</a>  
        <a class="layui-btn layui-btn-primary" href="{:url(banklist)}">结算卡列表</a>  
    </div>  -->
  <form class="layui-form">
    <div class="layui-form-item">
          <label class="layui-form-label">收款方式</label>
          <div class="layui-input-block">
            <select id="payid" lay-verify="required" lay-filter="payid">
              <option value=""></option>
              <option value="1">银行卡</option>
              <option value="2">微信</option>
              <option value="3">支付宝</option>
            </select>
          </div>
      </div>
  </form>
  <form class="layui-form" method="post" style="display: none;" id="bank">
  <input type="hidden" name="paytype" value="bank">
  <div class="layui-form-item">
    <label class="layui-form-label">开户省级市</label>
    <div class="layui-input-block">
      <input type="text" name="address" required  lay-verify="required" placeholder="请输入XX省XX市" autocomplete="off" class="layui-input">
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">收款银行</label>
    <div class="layui-input-block">
      <input type="text" name="bankname" required  lay-verify="required" placeholder="请输入XX银行" autocomplete="off" class="layui-input">
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">分行|支行</label>
    <div class="layui-input-block">
      <input type="text" name="branchname" required  lay-verify="required" placeholder="请输入XX分行|支行" autocomplete="off" class="layui-input">
    </div>
  </div>
  <!-- <div class="layui-form-item">
    <label class="layui-form-label">开户支行</label>
    <div class="layui-input-block">
      <input type="text" name="bankname2" required  lay-verify="required" placeholder="请输入开户行与支行地址" autocomplete="off" class="layui-input">
    </div>
  </div> -->
  <div class="layui-form-item">
    <label class="layui-form-label">身份证</label>
    <div class="layui-input-block">
      <input type="text" name="idcard" required lay-verify="required" placeholder="请输入身份证" autocomplete="off" class="layui-input">
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">银行卡账号</label>
    <div class="layui-input-block">
      <input type="text" name="bankno" required lay-verify="required" placeholder="请输入银行卡账号" autocomplete="off" class="layui-input">
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">收款人</label>
    <div class="layui-input-block">
      <input type="text" name="user" required lay-verify="required" placeholder="请输入收款人" autocomplete="off" class="layui-input">
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">银行预留手机号</label>
    <div class="layui-input-block">
      <input type="text" name="mobile" required lay-verify="required" placeholder="请输入银行预留手机号" autocomplete="off" class="layui-input">
    </div>
  </div>
  <!-- <div class="layui-form-item layui-form-text">
    <label class="layui-form-label">备注</label>
    <div class="layui-input-block">
      <textarea name="note" placeholder="请输入备注" class="layui-textarea"></textarea>
    </div>
  </div> -->
  <div class="layui-form-item">
    <div class="layui-input-block">
      <button class="layui-btn" lay-filter="addbtn" lay-submit>立即提交</button>
      <button type="reset" class="layui-btn layui-btn-primary" onclick="window.location='{:url('settle/index')}'">返回</button>
    </div>
  </div>
</form>

<form class="layui-form" method="post" style="display: none;" id="wxpay">
  <input type="hidden" name="paytype" value="wxpay">
  <div class="layui-form-item">
    <label class="layui-form-label">收款类型</label>
    <div class="layui-input-block">
      <input type="text" name="bankname" required  lay-verify="required" placeholder="请输入微信，请不要修改" class="layui-input" value="微信">
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">微信账号</label>
    <div class="layui-input-block">
      <input type="text" name="bankno" required lay-verify="required" placeholder="请输入微信账号" autocomplete="off" class="layui-input">
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">用户姓名</label>
    <div class="layui-input-block">
      <input type="text" name="user" required lay-verify="required" placeholder="请输入用户姓名" autocomplete="off" class="layui-input">
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">微信手机号</label>
    <div class="layui-input-block">
      <input type="text" name="mobile" required lay-verify="required" placeholder="请输入微信手机号" autocomplete="off" class="layui-input">
    </div>
  </div>
  <div class="layui-form-item" style="text-align: center;width: 100%">
    <label class="layui-form-label">微信收款码</label>
    <input id="w_file" name="w_file" type="hidden" required lay-verify="required">
    <div class="layui-input-block">
      <div class="layui-upload-drag" id="f_cardid_up" style="display: block;">
          <div class="bttext"><i class="layui-icon">&#xe608;</i><p>点击上传微信收款码</p></div>
      </div> 
    </div>
  </div>
  <div class="layui-form-item">
    <div class="layui-input-block">
      <button class="layui-btn" lay-filter="addbtn" lay-submit>立即提交</button>
      <button type="reset" class="layui-btn layui-btn-primary" onclick="window.location='{:url('settle/index')}'">返回</button>
    </div>
  </div>
</form>
<form class="layui-form" method="post" style="display: none;" id="alipay">
  <input type="hidden" name="paytype" value="alipay">
  <div class="layui-form-item">
    <label class="layui-form-label">收款类型</label>
    <div class="layui-input-block">
      <input type="text" name="bankname" required  lay-verify="required" placeholder="请输入收款类型" autocomplete="off" class="layui-input" value="支付宝">
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">支付宝账号</label>
    <div class="layui-input-block">
      <input type="text" name="bankno" required lay-verify="required" placeholder="请输入支付宝账号" autocomplete="off" class="layui-input">
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">用户姓名</label>
    <div class="layui-input-block">
      <input type="text" name="user" required lay-verify="required" placeholder="请输入用户姓名" autocomplete="off" class="layui-input">
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">支付宝手机号</label>
    <div class="layui-input-block">
      <input type="text" name="mobile" required lay-verify="required" placeholder="请输入支付宝手机号" autocomplete="off" class="layui-input">
    </div>
  </div>
  <div class="layui-form-item" style="text-align: center;width: 100%">
    <label class="layui-form-label">支付宝收款码</label>
    <input id="a_file" name="a_file" type="hidden" required lay-verify="required">
    <div class="layui-input-block">
      <div class="layui-upload-drag" id="s_cardid_up" style="display: block;">
          <div class="bttext"><i class="layui-icon">&#xe608;</i><p>点击上传支付宝收款码</p></div>
      </div> 
    </div>
  </div>
  <div class="layui-form-item">
    <div class="layui-input-block">
      <button class="layui-btn" lay-filter="addbtn" lay-submit>立即提交</button>
      <button type="reset" class="layui-btn layui-btn-primary" onclick="window.location='{:url('settle/index')}'">返回</button>
    </div>
  </div>
</form>
</div>
<script src="/static/plugins/layui/layui.js"></script> 
<script>
//Demo
layui.use(['form', 'layedit', 'laydate'], function(){
  var form = layui.form

  form.on('select(payid)', function(data){   
    var payid=data.value;
    if(payid == 1){
      var bank = document.getElementById("bank");
      bank.style.display="block";
      var wxpay = document.getElementById("wxpay");
      wxpay.style.display="none";
      var alipay = document.getElementById("alipay");
      alipay.style.display="none";
    }else if(payid == 2){
      var wxpay = document.getElementById("wxpay");
      wxpay.style.display="block";
      var bank = document.getElementById("bank");
      bank.style.display="none";
      var alipay = document.getElementById("alipay");
      alipay.style.display="none";
    }else if (payid == 3) {
      var alipay = document.getElementById("alipay");
      alipay.style.display="block";
      var wxpay = document.getElementById("wxpay");
      wxpay.style.display="none";
      var bank = document.getElementById("bank");
      bank.style.display="none";
    }
  });
    
  //监听提交
  form.on('submit(addbtn)', function(data){
        // alert(111);exit();
        $.post("{:url('')}",data.field,function(res){ 
            if(res.code===1){
                layer.msg(res.msg,{time:2000,icon:1},function(){  
                    // parent.location.reload();
                    // window.location=res.url;
                });
            }else{
                layer.msg(res.msg,{time:1000,icon:2}); 
            }
        });
        return false;
  });
});
</script>
<script>
layui.use(['jquery','form','upload'], function(){
    var $ = layui.jquery ,upload = layui.upload,form = layui.form;   
    // form.on('select(name_en)', function(data){
    //     var name=$("#name_en option:checked").text(); 
    //     $('#name').val(name);  
    // }); 
    //微信收款码上传
    up_f_cardid=upload.render({
        elem: '#f_cardid_up'
        ,url: '{:url("Uploads/upload")}' 
        ,done: function(res){ 
            if(res.code>0){
                $('#w_file').val(res.url);
                $('#f_cardid_up').html("<img src="+res.url+" height=72>");
            }else{ 
                return layer.msg(res.info);
            }
        } 
    });
     //支付宝收款码上传
    up_s_cardid=upload.render({
        elem: '#s_cardid_up'
        ,url: '{:url("Uploads/upload")}' 
        ,done: function(res){ 
            if(res.code>0){
                $('#a_file').val(res.url);
                $('#s_cardid_up').html("<img src="+res.url+" height=72>");
            }else{ 
                return layer.msg(res.info);
            }
        } 
    });
    // // 提交监听
    form.on('submit(addbtn)', function (data) {   
        $.post("{:url('seller/settle/addbank')}",data.field,function(res){ 
            if(res.code===1){
                layer.msg(res.msg,{time:2000,icon:1},function(){  
                    // parent.location.reload();
                    window.location=res.url;
                });
            }else{
                layer.msg(res.msg,{time:1000,icon:2}); 
            }
        });
        return false;
    });
}); 
</script> 
</body>
</html>